package com.example.webmvcconfig;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class SpringWebMvc extends WebMvcConfigurationSupport {
    //配置视图名称---到页面的映射
    @Override
    protected void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("admin/login").setViewName("admin/login");
        registry.addViewController("dev/login").setViewName("dev/login");

        registry.addViewController("dev/AppInfoAdd").setViewName("dev/AppInfoAdd");
        registry.addViewController("dev/DeveLoper").setViewName("dev/DeveLoper");
        registry.addViewController("/").setViewName("index");
    }

    //配置静态资源
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
       registry.addResourceHandler("static/**").addResourceLocations("classpath:/static/");
    }
}
